import Vue from 'vue'
import Router from 'vue-router'

// Vue.use(Router)

const Login = r => require.ensure([], () => r(require('@/pages/login/login-index')), 'login');
const Register = r => require.ensure([], () => r(require('@/pages/login/login-register')),'register');
const Home = r => require.ensure([], () => r(require('@/pages/home/home-index')),'home');
const ProductList = r => require.ensure([], () => r(require('@/pages/product/product-list')),'product');
const AccountList = r => require.ensure([], () => r(require('@/pages/account/account-list')),'accountList');
const H5 = r => require.ensure([], () => r(require('@/pages/h5/h5-index')),'h5');
const DistributionNetworkList = r => require.ensure([], () => r(require('@/pages/distributionNetwork/distributionNetwork-List')),'distributionNetwork');

Vue.use(Router)

const routes = [
  {
    path: '/',
    name: "login",
    component: Login
  },
  {
    path: '/register',
    name: "register",
    component: Register
  },
  {
    path: '/home',
    name: 'home',
    redirect: '/productList',
    component: Home,
    children: [
      {
        path: '/productList',
        name: 'productList',
        component: ProductList
      },
      {
        path: '/accountList',
        name: 'accountList',
        component: AccountList
      },
      {
        path: '/h5',
        name: 'h5',
        component: H5
      },
      {
        path: '/distributionNetworkList',
        name: 'distributionNetworkList',
        component: DistributionNetworkList
      }
    ]
  },
]

export default new Router({
  routes,
  strict: process.env.NODE_ENV !== 'production',
})
